package com.yellowpage.nsp.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;

import com.yellowpage.white.common.Constants;
import com.yellowpage.white.common.PageRender;
import com.yellowpage.white.dao.QueryAssistantSQL;
import com.yellowpage.white.service.BaseServiceImpl;

import com.yellowpage.nsp.data.NspErrorCode;
import com.yellowpage.nsp.dao.NspErrorCodeDao;

public class NspErrorCodeServiceImpl extends BaseServiceImpl implements NspErrorCodeService {
	  private NspErrorCodeDao nspErrorCodeDao;
	
	  public void setNspErrorCodeDao(NspErrorCodeDao nspErrorCodeDao) {
		  this.nspErrorCodeDao = nspErrorCodeDao;
	  }
	
	
	  /* Smooth generate Method */ 
	  public NspErrorCode getNspErrorCode(Long id){
	      return nspErrorCodeDao.get(id);
	  }
	  
    public List<NspErrorCode> getAllNspErrorCode(){
        return nspErrorCodeDao.getAll();
    }
    
    public List<Map> queryNspErrorCodeByPage(Map queryMap, PageRender pageRender) {		
        
		QueryAssistantSQL sqlAssistant = baseDao.newQueryAssistantSQL(
				"SELECT a.ERROR_CODE , a.ERROR_DESC    FROM NSP_ERROR_CODE a WHERE 1=1 ")
				    			.addCondition(" and ERROR_CODE = :errorCode ")
							    			.addCondition(" and ERROR_DESC = :errorDesc ")
							    ; 		    
		    

		List<Map> resultList = sqlAssistant.queryByPage(
				baseDao.getConnection(), queryMap, pageRender);

		return resultList;
	}
    
    
    public void saveNspErrorCode(NspErrorCode nspErrorCode){
        nspErrorCodeDao.save(nspErrorCode);
    }
    
	  public void updateNspErrorCode(NspErrorCode nspErrorCode){
	      nspErrorCodeDao.update(nspErrorCode);
	  }
	  
	  public void delete(List deleteList){
	      nspErrorCodeDao.remove(deleteList);
	  }
	  
	  
	 
	
}	